<template>
	<view>
		<tn-nav-bar :isBack='true' :backTitle='" "' bottomShadow :alpha="alpha">个人设置</tn-nav-bar>
		<image src="/static/product/topbg.png" class="topbg" mode=""></image>
		<view :style="{paddingTop: vuex_custom_bar_height + 'px'}" class="con">
			<view class="box">
				<tn-list-view :card="true" unlined="all">
					 <view slot="title" class="list-title-container">
					    账号设置
					  </view>
					<block v-for="(item, index) in zhlist" :key="index">
						<tn-list-cell :arrow="true" unlined hover @click="click(item)">
							<view class="tn-flex tn-flex-col-center">
								<view class="left">
									<image :src="'/static/my/'+item.icon+'.png'" :style="{width: item.w,height: item.h}" mode=""></image>
								</view>
								{{item.name}}
							</view>
							<view class="value" v-if="item.value">
								{{item.value}}
							</view>
						</tn-list-cell>
					</block>
				</tn-list-view>
				<tn-list-view :card="true" unlined="all">
					 <view slot="title" class="list-title-container">
					    系统设置
					  </view>
					<block v-for="(item, index) in xtlist" :key="index">
						<tn-list-cell :arrow="true" unlined hover  @click="click(item)">
							<view class="tn-flex tn-flex-col-center">
								<view class="left">
									<image :src="'/static/my/'+item.icon+'.png'" :style="{width: item.w,height: item.h}" mode=""></image>
								</view>
								{{item.name}}
							</view>
							<view class="value" v-if="item.value">
								{{item.value}}
							</view>
						</tn-list-cell>
					</block>
				</tn-list-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				alpha: true,
				zhlist:[
					{
						name:'注销账号',
						icon:'zx',
						w:'32rpx',
						h:'30rpx',
						value:'',
						url:''
					},
					{
						name:'退出登录',
						icon:'loginout',
						w:'46rpx',
						h:'47rpx',
						value:'',
						url:''
					},
				],
				xtlist:[
					{
						name:'清理缓存',
						icon:'ql',
						w:'45rpx',
						h:'45rpx',
						value:'63.8M',
						url:''
					},
					{
						name:'飞象云游隐私政策',
						icon:'ys',
						w:'30rpx',
						h:'33rpx',
						value:'',
						url:'/pages/my/xiyi?name=secret&title=飞象云游隐私政策'
					},
					{
						name:'飞象云游服务条款',
						icon:'tk',
						w:'46rpx',
						h:'46rpx',
						value:'',
						url:'/pages/my/xiyi?name=userSerive&title=飞象云游服务条款'
					},
				]
			}
		},
		methods: {
			click(item){
				console.log(item)
				let _this=this
				if(item.name=='退出登录'){
					uni.showModal({
						title:'确定要退出该账号？',
						success(r) {
							if(r.confirm){
								_this.$tn.vuex('vuex_userinfo', {})
								_this.$tn.vuex('vuex_token', '')
								uni.navigateBack()
							}
						}
					})
					
				}
				if(item.name=='清理缓存'){
					this.$tn.message.toast('缓存已清理')
					this.xtlist[0].value=0
				}
				if(item.name=='注销账号'){
					this.$tn.message.toast('请联系客服注销账号')
				}
				if(item.url){
					uni.navigateTo({
						url:item.url
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F7F7F9;
	}

	.con {
		padding: 30rpx;
		position: relative;

		.box {
			margin-top: 30rpx;
			width: 689rpx;
			background: #FFFFFF;
			border-radius: 30rpx;
			padding-bottom: 28rpx;
			.list-title-container{
				padding: 46rpx 0 33rpx 44rpx;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				color: #888888;
				line-height: 24rpx;
			}
			.tn-list-cell{
				padding: 0 40rpx 0 36rpx;
				height: 104rpx;
				display: flex;
				align-items: center;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 30rpx;
				color: #0B0B0B;
				line-height: 30rpx;
				justify-content: space-between;
			}
			.left{
				width: 46rpx;
				display: flex;
				justify-content: center;
				margin-right: 20rpx;
			}
			.value{
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 25rpx;
				color: #B2B2B2;
				line-height: 25rpx;
				margin-right: 22rpx;
			}
		}
	}
</style>